/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package model;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;

/**
 *
 * @author Matthy & Jelle
 */
@Entity
@Table(name="T_VOORSTELLING")
public class Voorstelling {
  @Id @GeneratedValue(strategy= GenerationType.IDENTITY)
  private Integer id;
  @ManyToOne(optional=false, cascade=javax.persistence.CascadeType.PERSIST)
  @JoinColumn(name="zaal_id")
  private Zaal zaal;
  @ManyToOne(optional=false, cascade=javax.persistence.CascadeType.PERSIST)
  @JoinColumn(name="film_id")
  private Film film;
  @Temporal(javax.persistence.TemporalType.TIMESTAMP)
  private Date tijdstip;
  private String taal;
  private String ondertiteling;
  private String type;

  public Integer getId() {
    return id;
  }

  public Zaal getZaal() {
    return zaal;
  }

  public Film getFilm() {
    return film;
  }

  public Date getTijdstip() {
    return tijdstip;
  }

  public String getTaal() {
    return taal;
  }

  public String getOndertiteling() {
    return ondertiteling;
  }

  public String getType() {
    return type;
  }

  public void setId(Integer id) {
    this.id = id;
  }

  public void setZaal(Zaal zaal) {
    this.zaal = zaal;
  }

  public void setFilm(Film film) {
    this.film = film;
  }

  public void setTijdstip(Date tijdstip) {
    this.tijdstip = tijdstip;
  }

  public void setTaal(String taal) {
    this.taal = taal;
  }

  public void setOndertiteling(String ondertiteling) {
    this.ondertiteling = ondertiteling;
  }

  public void setType(String type) {
    this.type = type;
  }

  @Override
  public String toString() {
    DateFormat format = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");

    return film.getTitel() + " - " + format.format(tijdstip) + " Complex:" + zaal.getComplex().getLocatie();
  }

  public String getInfo() {
    return "Taal: "+ taal + "\nOndertiteling:" + ondertiteling + "\nType:" + type;
  }


}
